﻿

layui.use('layer', function () {
    var $ = layui.jquery, layer = layui.layer;

    $(document).ready(function () {
        var price = parseInt($("#price").text());
        var count = parseInt($("#count").text());
        var total = price * count;
        $(".total").text(total);
    });

    $("#submit-bt").click(function () {
        $.ajax({
            url: "/Page/PayOrder",
            type: "POST",
            async: false,
            data: {
                DeliverId: $(".ads-this>.deliver-head>input").val(),
                Count: $("#count").text(),
                GoodsId: $("#goods_id").val(),
                ClientMark:$("#client_mark").val(),
            },
            success: function (data) {
                if (data.success != "") {
                    location.href = "/Page/PayOrder?orderId="+ data.orderId;
                } else if (data.error != "") {
                    layer.msg(data.error);
                }
            },
        })
    })

    $(".deliver-info").each(function () {
        $(this).click(function () {
            $(".deliver-info").each(function () {
                $(this).removeClass("ads-this");
            })
            $(this).addClass("ads-this");
        })
    })


})


